package com.weiwei.diancan.utils;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;

import com.weiwei.diancan.bean.WaterInfo;
import com.weiwei.diancan.cache.CacheConfig;

import weiwei.com.weiweilibrary.views.ToastUtil;

/**
 * Created by weiwei on 2017/4/19.
 * Describe:
 */

public class PessmionUtils {

    public static boolean check(Context context,String type){
//        WaterInfo.WaiterInfoBean waterInfo = CacheConfig.getInst().getWaterInfo();
//        String waiter_jurisdiction = waterInfo.getWaiter_jurisdiction();
        String waiter_jurisdiction = CacheConfig.getInst().getWator_per(context);
        if(TextUtils.isEmpty(waiter_jurisdiction)){
            ToastUtil.showToast(context,"请绑定工号！");
            return false;
        }else{
            if(waiter_jurisdiction.contains(type)){
                return true;
            }else {
                ToastUtil.showToast(context,"您没有该项操作权限，请联系店铺管理员开启相关权限!");
                return false;
            }
        }
    }

    public static boolean check_nomessage(Context context,String type){
//        WaterInfo.WaiterInfoBean waterInfo = CacheConfig.getInst().getWaterInfo();
//        String waiter_jurisdiction = waterInfo.getWaiter_jurisdiction();
        String waiter_jurisdiction = CacheConfig.getInst().getWator_per(context);
        if(TextUtils.isEmpty(waiter_jurisdiction)){
            ToastUtil.showToast(context,"请绑定工号！");
            return false;
        }else{
            if(waiter_jurisdiction.contains(type)){
                return true;
            }else {
                return false;
            }
        }
    }
}
